/***************************************************************************
  A SymbolBrowser plugin for JuffEd editor.

  Copyright: 2010 Aleksander Sokoloff <asokol@mail.ru>


  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License.
  version 2 as published by the Free Software Foundation.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software Foundation,
  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
***************************************************************************/

#include "katesymbolbrowserplugin.h"
#include "katesymbolbrowserview.h"
#include "katesybmolbrowserconfigpage.h"
#include "constants.h"

#include <kate/plugin.h>
#include <kate/mainwindow.h>
#include <kate/documentmanager.h>
#include <ktexteditor/document.h>

#include <kpluginloader.h>
#include <kaboutdata.h>
#include <klocale.h>
#include <QIcon>
#include <QDebug>



K_PLUGIN_FACTORY_DEFINITION(KateSymbolBrowserFactory, registerPlugin<KateSymbolBrowserPlugin>();)
K_EXPORT_PLUGIN(KateSymbolBrowserFactory(
        KAboutData("katesymbolbrowser",
                   "katesymbolbrowserplugin",
                   ki18n("Symbol Browser"),
                   KATE_PLUGIN_VERSION,
                   ki18n("Symbol Browser plugin"),
                   KAboutData::License_GPL_V2)
                )
       )


/**********************************************************
 *
 **********************************************************/
KateSymbolBrowserPlugin::KateSymbolBrowserPlugin(QObject *parent, const QList<QVariant>&)
: Kate::Plugin ((Kate::Application*)parent)
{

}


/**********************************************************
 *
 **********************************************************/
KateSymbolBrowserPlugin::~KateSymbolBrowserPlugin()
{
}



/**********************************************************
 *
 **********************************************************/
Kate::PluginView *KateSymbolBrowserPlugin::createView(Kate::MainWindow *mainWindow)
{
    KateSymbolBrowserView *view = new KateSymbolBrowserView(this, mainWindow);
    mViews.append(view);
    connect(this, SIGNAL(globalSettingsChanged()), view, SLOT(globalSettingsChanged()));

    return view;
}


/**********************************************************
 *
 **********************************************************/
Kate::PluginConfigPage* KateSymbolBrowserPlugin::configPage(uint number, QWidget *parent, const char *name)
{
    Q_UNUSED(name)

    if (number != 0)
        return 0;

    KateSybmolBrowserConfigPage *page = new KateSybmolBrowserConfigPage(parent);
    connect(page, SIGNAL(settingsChanged()), this, SIGNAL(globalSettingsChanged()));
    return page;
}


/**********************************************************
 *
 **********************************************************/
QString KateSymbolBrowserPlugin::configPageName(uint number) const
{
    if (number != 0) return QString();
    return i18n("Symbol browser");
}


/**********************************************************
 *
 **********************************************************/
QString KateSymbolBrowserPlugin::configPageFullName(uint number) const
{
    if (number != 0) return QString();
    return i18n("Symbol Browser settings");
}


/**********************************************************
 *
 **********************************************************/
KIcon KateSymbolBrowserPlugin::configPageIcon (uint number) const
{
    if (number != 0) return KIcon();
    return KIcon(QIcon(":icon_main"));
}

